package xhwl.hmo.mall.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.Constant;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017-11-03.
 */

public class OnlinePayApi extends BaseApi {
    OnlinePayReq req;
    public OnlinePayApi(String order_id, String serial_number, String order_status){
        req=new OnlinePayReq(order_id,serial_number,order_status);
        setShowDialog(true);
    }
    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).onLinePay(requestBody);
    }
    public class OnlinePayReq{
        public String order_id;
        public String serial_number;
        public String order_status;
        public String client_id;

        public OnlinePayReq(String order_id, String serial_number, String order_status) {
            this.order_id = order_id;
            this.serial_number = serial_number;
            this.order_status = order_status;
            this.client_id= Constant.CLIENT_TYPE;
        }
    }
}
